package com.yyb.config;

import com.yyb.constants.CoreConstant;
import com.yyb.interceptor.LoginInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 
 * 
 * 
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Resource
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns(
                        CoreConstant.LOGIN_URL,
                        CoreConstant.CAPTCHA_URL,
                        "/doc.html",
                        "/swagger-ui/**",
                        "/webjars/**",
                        "/v3/api-docs/**"
                );
    }
}
